﻿using System;
using Game.Toolkit;

namespace Game.Editor.Toolbox
{
    public class SelectedBuildingEventArgs : EventArgs
    {
        public GameObjectGroup GameObjectGroup
        {
            get; set;
        }
    }
    
    public static class SelectedBuilding
    {
        public static event EventHandler<SelectedBuildingEventArgs> Selected;
        
        private static GameObjectGroup _GameObjectGroup;
        
        public static GameObjectGroup GameObjectGroup
        {
            get { return _GameObjectGroup; }
            set 
            {
                if (_GameObjectGroup != value)
                {
                    _GameObjectGroup = value; 
                    FireSelected();
                }
            }
        }
        
        private static void FireSelected()
        {
            if (Selected != null)
            {
                SelectedBuildingEventArgs args = 
                    new SelectedBuildingEventArgs();
                args.GameObjectGroup = _GameObjectGroup;
                Selected(_GameObjectGroup, args);
            }
        }
        
    }
}
